package com.flash.CashAdministration.mapper;

import com.flash.BusinessData.entity.CashAccrued;
import com.flash.BusinessParameters.entity.Cash;
import com.flash.CashAdministration.entity.FundsAllot;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;
@Mapper
public interface FundsAllotMapper {
    @Select("select * from (select rownum rn,f.* from fundsAllot f) where 1=1 ${businessTime} and rn between #{page} and #{limit}")
    public List<FundsAllot> selectFundsAllotMap(Map map);

    @Delete("delete from fundsAllot where fundsAllotId = #{fundsAllotId}")
    public int deleteFundsAllot(String fundsAllotId);

        @Insert("insert into fundsAllot values(#{fundsAllotId},#{cashId},#{fundId},#{allotType},#{allotDirection},#{allotMoney},#{businessId},#{businessTime},#{allotTime},#{allotRemark})")
    public int insertFundsAllot(FundsAllot fundsAllot);

    @Select("select count(*) from fundsAllot")
    public int selectCountFundsAllot();

    @Update("update fundsAllot set cashId=#{cashId},fundId=#{fundId},allotType=#{allotType},allotDirection=#{allotDirection},allotMoney=#{allotMoney},businessId=#{businessId},businessTime=#{businessTime},allotTime=#{allotTime},allotRemark = #{allotRemark} where fundsAllotId=#{fundsAllotId}")
    public int updateFundsAllot(FundsAllot fundsAllot);
    @Select("select cashId from Cash where accountName = #{accountName}")
    public String selectCash(String accountName);

    @Delete("delete from fundsAllot where allotTime = #{dateAccrualStock} and cashId=#{cashId}")
    public int deleteNew(CashAccrued cashAccrued);

    @Delete("delete from fundsAllot where businessId=#{businessId}")
    public int deleteBusinessId(String businessId);
}
